﻿{$header}
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">供应商信息 [ <a href="__URL__">返回列表</a> ] 
<div class="btn-group pull-right">
	<button class="btn btn-primary" onclick="addContact({$vo.id})"><i class="icon-user icon-white"></i> 创建联系人</button>
	<button class="btn btn-primary" onclick="add({$vo.id})"><i class="icon-question-sign icon-white"></i> 创建询价单</button>
	<button class="btn btn-primary" onclick="add({$vo.id})"><i class="icon-shopping-cart icon-white"></i> 创建采购单</button>
	<button class="btn btn-primary" onclick="editRank({$vo.id})"><i class="icon-user icon-white"></i> 修改供应商等级</button>
</div>
  </h3>
<div id="result" class="result none"></div>
<ul id="myTab" class="nav nav-tabs">
            <li class="active"><a href="#home" data-toggle="tab">供应商信息</a></li>
            <li><a href="#profile" data-toggle="tab">联系人</a></li>
          	<li><a href="#ask_supplier" data-toggle="tab">采购询价</a></li>
          	<li><a href="#buy" data-toggle="tab">采购单</a></li>
          	<li><a href="__URL__/plist/id/{$vo.id}">产品</a></li>
          	<li><a href="__URL__/product_class/id/{$vo.id}">主要产品类别(定制)</a></li>
          	<li><a href="__URL__/reaction_type/id/{$vo.id}">擅长反应类型(特色)</a></li>
          </ul>
          <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade in active" id="home">

<form class="form-horizontal well" method='post' id="form1" action="__URL__/update/">
<table cellpadding=3 cellspacing=3 >

<tr>
	<td class="tRight" >公司中文名称：</td>
	<td class="tLeft" >
            <input type="text" name="name" value="{$vo.name}" class="input-large">
        </td>
        <td class="tRight" >公司英文名称：</td>
	<td class="tLeft" >
            <input type="text" name="ename" value="{$vo.ename}" class="large">
        </td>
</tr>
<tr>
	<td class="tRight" >电话：</td>
	<td class="tLeft" >
            <input type="text"  class="large"  name="phone" value="{$vo.phone}" />
        </td>

	<td class="tRight" >传真：</td>
	<td class="tLeft" >
            <input type="text"  name="fax" value="{$vo.fax}" />
        </td>
</tr>

<tr>
	<td class="tRight" >email：</td>
	<td class="tLeft" >
            <input type="text"  name="email" value="{$vo.email}" />
        </td>
	<td class="tRight" >网址：</td>
	<td class="tLeft" >
            <input type="text"  name="website" value="{$vo.website}" />
        </td>
</tr>
<tr>
	<td class="tRight" >主要联系人</td>
	<td class="tLeft" colspan="3">
            <select name="contact_id">
            	<option> 请选择联系人</option>
            	<volist name="contacts" id="ct">
            		<option value="{$ct.id}" <eq name="vo.contact_id" value="$ct.id">selected</eq> > {$ct.name}</option>	
            	</volist>
            </select>
        </td>
</tr>
<tr>
	<td class="tRight" >供应商等级</td>
	<td class="tLeft" >{$vo.rank|getConfigVal='supplier_rank'}
        </td>
</tr>
<tr>
	<td class="tRight" >地址：</td>
	<td class="tLeft" colspan="3">
            <input type="text"  class="input-xxlarge"  name="address" value="{$vo.address}" />
        </td>	
</tr>
<tr>
	<td class="tRight" >付款资料：</td>
	<td class="tLeft" colspan="3">
		<textarea class="input-xxlarge" id="textarea" name="bill_info" rows="3">{$vo.bill_info}</textarea>
    </td>
</tr>
<tr>
	<td class="tRight" >开票资料：</td>
	<td class="tLeft" colspan="3">
		<textarea class="input-xxlarge" id="textarea" name="invoice_info" rows="3">{$vo.invoice_info}</textarea>
    </td>
</tr>
<tr>
	<td class="tRight">简介：</td>
	<td class="tLeft" colspan="3"><textarea name="profile" rows="5" class="input-xxlarge">{$vo.profile}</textarea>
        </td>
</tr>
<tr>
	<td class="tRight" >排序：</td>
	<td class="tLeft" >
            <input type="text"  name="sort" value="{$vo.sort}" />常用的供应商可以排序位小些，排在前面
        </td>
	<td class="tRight">状态：</td>
	<td class="tLeft">
		<SELECT class="small bLeft"  name="status">
			<option
				<eq name="vo.status" value="1" >selected</eq>
				value="1">启用
			</option>
			<option <eq name="vo.status" value="0" >selected</eq>
			value="0">禁用
		</option>
	</SELECT></td>
</tr>

<tr>
	<td></td>
	<td class="center">
        <input type="hidden" value="{$vo.id}" name="id">
	<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> 保存</button>
	<button type="reset" onclick="javascript:history.back()" class="btn btn-primary offset1"><i class="icon-arrow-left icon-white"></i> 返回</button>
	</td>
</tr>
</table>
</form>
</div><!--home tab-->
	<div class="tab-pane fade in active" id="profile">
		<table class="table">
			<tr><th>编号</th><th>联系人</th><th>职位</th><th>部门</th><th>手机</th><th>QQ</th><th>MSN</th> <th>电话</th><th>传真</th><th>Email</th><th>创建时间</th><th>编辑</th><th>删除</th> </tr>
			<volist name="contacts" id="ca">
				<tr>
				<td>{$ca.id}</td>
				<td>{$ca.name}</td>
				<td>{$ca.title}</td>
				<td>{$ca.dept}</td>
				<td>{$ca.mobile}</td>
				<td>{$ca.qq}</td>
				<td>{$ca.msn}</td>
				<td>{$ca.phone}</td>
				<td>{$ca.fax}</td>
				<td>{$ca.email}</td>
				<td>{$ca.create_time|toDate}</td>
				<td><a href="__APP__/Contact/edit/id/{$ca.id}">编辑</a> </td>
				<td><a href="__APP__/Contact/delete/id/{$ca.id}">删除</a> </td>
			</tr>
			</volist>
		</table>
        {$page_contacts}
	</div><!--profile-->
	<div class="tab-pane fade in active" id="ask_supplier">
		<!--询价记录-->
		<table class="table table-bordered table-striped">
    <tr><td colspan=10 class="alert alert-info"><i class="icon-arrow-down"></i> 历史询价</td> </tr>
    <tr> <th>询价单号</th><th>联系人</th><th>报价</th><th>询价时间</th><th>更新时间</th><th>询价等级</th><th>询单要求</th> </tr>
      <volist name="his_offers" id="hoff">
        <tr>
          <td><a href="__APP__/Ask_supplier/edit/id/{$hoff.ask_supplier_id}" target=
          	"_blank"> {$hoff.ask_supplier_id|getModelName='Ask_supplier','mano'}</a></td>
          <td>{$hoff.contact_id|getContactInfo}</td>
          <td>{$hoff.offer} </td>
          <td>{$hoff.create_time|toDate}</td>
          <td>{$hoff.update_time|toDate}</td>
          <td>{$hoff.status|getConfigVal='askrank'}</td>
          <td>{$hoff.specification}</td>
        </tr>
      </volist>
    </table>

{$page_his_offers}
</div><!--ask_supplier-->
<div class="tab-pane fade in active" id="buy">
	<table class="table">
			<tr><th>编号</th><th>采购单号</th><th>销售订单号</th><th>产品</th><th>数量</th><th>单价</th><th>总价</th><th>采购状态</th><th>经办人</th><th>采购时间</th></tr>
			<volist name="buys" id="buy">
				<tr>
				<td>{$buy.id}</td>
				<td>{$buy.mano}</td>
				<td>{$buy.order_id|getModelName='Order','mano'}</td>
				<td>{$buy.product_id|getModelName='Product'}</td>
				<td>{$buy.number}</td>
				<td>{$buy.price}</td>
				<td>{$buy.total}</td>
                <td>{$buy.status|getConfigVal='buystatus'}</td>
				<td>{$buy.user_id|getModelName='User'}</td>
				<td>{$buy.create_time|toDate}</td>
				<td><a href="__APP__/Contact/edit/id/{$ca.id}">编辑</a> </td>
				<td><a href="__APP__/Contact/delete/id/{$ca.id}">删除</a> </td>
			</tr>
			</volist>
		</table>
		{$page_buys}
</div><!--buy-->
</div>
</div>
<include file="Public:footer" />
<load href="__PUBLIC__/Js/jquery-1.7.2.min.js"/>
<load href="__PUBLIC__/bootstrap/js/bootstrap-tab.js" />
<script type="text/javascript">
	function addContact(id){
		if(id)
			location.href= APP+"/Contact/add/sid/"+id;
		else
			location.href= APP+"/Contact/add/";
	}
    function editRank(id){
        location.href=APP+"/Supplier/edit_rank/id/"+id;    
    }

</script>
